home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / answers / rec / puzzles / archive / induction < prev    next >
Text File  |  1993-08-17  |  16KB  |  416 lines

  1. Newsgroups: rec.puzzles,news.answers,rec.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!spool.mu.edu!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!questrel!chris
  3. From: chris@questrel.com (Chris Cole)
  4. Subject: rec.puzzles Archive (induction), part 16 of 35
  5. Message-ID: <puzzles/archive/induction_745653851@questrel.com>
  6. Followup-To: rec.puzzles
  7. Summary: This is part of an archive of questions
  8.  and answers that may be of interest to
  9.  puzzle enthusiasts.
  10.  Part 1 contains the index to the archive.
  11.  Read the rec.puzzles FAQ for more information.
  12. Sender: chris@questrel.com (Chris Cole)
  13. Reply-To: archive-comment@questrel.com
  14. Organization: Questrel, Inc.
  15. References: <puzzles/archive/Instructions_745653851@questrel.com>
  16. Date: Wed, 18 Aug 1993 06:05:34 GMT
  17. Approved: news-answers-request@MIT.Edu
  18. Expires: Thu, 1 Sep 1994 06:04:11 GMT
  19. Lines: 394
  20. Xref: senator-bedfellow.mit.edu rec.puzzles:24998 news.answers:11518 rec.answers:1918
  21.  
  22. Archive-name: puzzles/archive/induction
  23. Last-modified: 17 Aug 1993
  24. Version: 4
  25.  
  26.  
  27. ==> induction/handshake.p <==
  28. A married couple organizes a party. They only invite other married
  29. couples. At least one person of an invited couple is acquainted to
  30. at least the host or the hostess (so between sets {host,hostess} and
  31. {male of invited couple, female of invited couple} there exists at 
  32. least one relation, but two, three or four relations is also possible).
  33. Upon arrival at the party, each person shakes hands with all other
  34. guests he/she doesn't know yet (it is assumed everybody knows 
  35. him/herself and his/her partner). 
  36.  
  37. When all couples have arrived and all the handshaking has been done,
  38. the host mingles between the guests and ask everybody (including his
  39. wife): "How many hands did you shake?". To his surprise, all responses
  40. are different.
  41.  
  42. With the above information, you must be able to determine how many
  43. hands the host and hostess each shook.
  44.  
  45. ==> induction/handshake.s <==
  46. Assume there were 2n people (including host and hostess)
  47. in the party.
  48.  
  49. 1. When the host asked the question he must have got
  50.    2n-1 responses (including from his wife).
  51.  
  52. 2. All of the responses were different.
  53.  
  54. The responses have to be (0, 1, 2, 3, ..., 2n-2)
  55. to satisfy the above requirements. As 2n-2 is the maximum
  56. possible handshakes any person in this party could have made.
  57.  
  58. /**   Below,
  59.       P{x} - means a person who shook x hands.
  60.       H    - means the host
  61.  **/
  62.  
  63. H: <-------->2n-2   0
  64.        2n-3        1
  65.           2n-4          2
  66.       2n-5          3
  67.           .             .
  68.            .           .
  69.              .       .
  70.           n  n-1 n-2
  71.  
  72.         (There are 2n-1 on the circle.)
  73.  
  74. P{2n-2} must have handshaked with H (because in the circle he
  75. can handshake with only 2n-3. He has to exclude himself also.)
  76.  
  77. P{2n-3} must have handshaked with H (because in the circle he
  78. can handshake with only 2n-4.)
  79.  
  80. P{2n-4} must have handshaked with H (because in the circle he
  81. can handshake with only 2n-5.)
  82.  
  83. P{n} must have handshaked with H (because in the circle he
  84. can handshake with only n-1.)
  85.  
  86. from P{n-1} to P{0} nobody  handshakes with H, because, for them
  87. the handshake numbers are satisfied on the circle itself.
  88.  
  89. This leaves H with (n-1) handshakes.
  90. ----------------------------------
  91.  
  92. P{0} must be the spouse of P{2n-2} (since P{2n-2} handshakes with
  93. everbody else.)
  94. .
  95. .
  96. .
  97. same logic till P{n-2}
  98.  
  99. leaving the Hostess to be P{n-1}.
  100.  
  101. ----------------------------------------
  102. So,
  103. Host    - made (n-1) handshakes.
  104. Hostess - made (n-1) handshakes.
  105.  
  106. where n is the number of couple including
  107. the host couple.
  108. ----------------------------------------
  109.  
  110. ==> induction/hanoi.p <==
  111. Is there an algorithm for solving the Hanoi tower puzzle for any number
  112. of towers?  Is there an equation for determining the minimum number of
  113. moves required to solve it, given a variable number of disks and towers?
  114.  
  115. ==> induction/hanoi.s <==
  116. The best way of thinking of the Towers of Hanoi problem is inductively.
  117. To move n disks from post 1 to post 2, first move (n-1) disks
  118. from post 1 to post 3, then move disk n from post 1 to post 2, then move
  119. (n-1) disks from post 3 to post 2 (same procedure as moving (n-1) disks
  120. from post 1 to post 3).  In order to figure out how to move (n-1) disks
  121. from post 1 to post 3, first move (n-2) disks . . . .
  122.  
  123. As far as an algorithm which straightens out any legal position is
  124. concerned, the algorithm would go something like this:
  125.  
  126. 1.  Find the smallest disk.  Call the post that it's on post 1. 
  127.  
  128. 2.  Find the smallest disk which is not on post 1.  This disk is, say,
  129. size k.  (I am calling the smallest disk size 1 here.)  Call the post
  130. that disk k is on post 2.  Disks 1 through (k-1) are then all stacked up
  131. correctly on post 1 disk k is on top of post 2.  This follow from the
  132. fact that the disks are in a legal postition.
  133.  
  134. 3.  Move disks 1 through (k-1) from post 1 to post 2, ignoring the other
  135. disks.  This is just the standard Tower of Hanoi problem for (k-1)
  136. disks.
  137.  
  138. 4.  If the disks are not yet correctly arranged, repeat from step 1.
  139.  
  140. In fact, this gives the straightening with the fewest number of moves. 
  141.  
  142. With 3 towers, for N number of disks, the formula for the minimum number of
  143. moves to complete the puzzle correctly is:
  144.         (2^N) - 1
  145.  
  146. This bit of ancient folklore was invented by De Parville in 1884.
  147.  
  148. ``In the great temple at Benares, says he, beneath the dome which
  149.   marks the centre of the world, rests a brass plate in which are
  150.   fixed three diamond needles, each a cubit high and as thick as
  151.   the body of a bee.  On one of these needles, at the creation,
  152.   God placed sixty-four discs of pure gold, the largest disc resting
  153.   on the brass plate, and the others getting smaller and smaller
  154.   up to the top one.  This is the Tower of Bramah.  Day and night
  155.   unceasingly the priests transfer the discs from one diamond needle
  156.   to another according to the fixed and immutable laws of Bramah,
  157.   which require that the priest on duty must not move more than one
  158.   disc at a time and that he must place this disc on a needle so
  159.   that there is no smaller disc below it.  When the sixty-four
  160.   discs shall have been thus transferred from the needle on which
  161.   at the creation God placed them to one of the other needles,
  162.   tower, temple, and Brahmins alike will crumble into dust, and 
  163.   with a thunderclap the world will vanish.''  (W W R Ball,
  164.   MATHEMATICAL RECREATIONS AND ESSAYS, p. 304)
  165.  
  166. This has been discussed by several authors, e.g.
  167.  
  168.     Er, Info Sci 42 (1987) 137-141.
  169.     Graham, Knuth and Patashnik, _Concrete_Mathematics_.
  170.  
  171. There are many papers claiming to solve this, and they are probably
  172. all correct but they rely on the unproven "Frame's conjecture".
  173. In particular, for the 4 peg case the conjecture states that an optimal
  174. solution begins by forming a substack of the k smallest discs, then moving
  175. the rest, and then moving those k again; k to be determined.
  176.  
  177. Here is a extensible bc program that does the same work. The output
  178. format is not that great. We get 300 numbers as output. The first
  179. hundred represent N, the next 100 represent f(N) and the last hundred
  180. represent i, which is the number of discs to move to tmp1 using f(N).
  181. For convenience, I have here some values for N <= 48. Enjoy.
  182.  
  183. Sharma
  184.  
  185.  
  186. N     1   2   3  4  5   6  7  8  9  10  11 12 13  14  15  16  17  18  19 
  187. f(N)     1   3   5  9 13  17 25 33 41  49  65 81 97 113 129 161 193 225 257 
  188. i     0   1   1  2  2   3  3  4  5   6   6  7  8   9  10  10  11  12  13 
  189.  
  190.  
  191. N    20   21  22  23  24  25  26  27  28  29  30   31   32   33   34   35 
  192. f(N)    289 321 385 449 513 577 641 705 769 897 1025 1153 1281 1409 1537 1665
  193. i    14   15  15  16  17  18  19  20  21  21   22   23   24   25   26   27 
  194.  
  195. N    36    37    38    39     40    41   42   43   44   45   46   47   48 
  196. f(N)    1793 2049  2305  2561   2817  3073 3329 3585 3841 4097 4609 5121 5633
  197. i    28    28    29    30     31    32    33   34   35   36  36   37   38 
  198.  
  199.  
  200. /* This is the bc program that gives f(N) for 4 peg case */
  201.  
  202. w = 101; /* This represents the number of disks */
  203.  
  204. m[0] = 0;
  205. m[1] = 1;
  206. m[2] = 3;
  207. m[3] = 5;
  208. m[4] = 9;
  209. m[5] = 13;
  210. m[6] = 17;
  211.  
  212. /* f(n) is the function that gives the min # of moves for 4 peg case */
  213. define f(n) {
  214.   return (m[n]);
  215. }
  216.  
  217. /* g(n) is the function that fives the min # of moves for 3 peg case */
  218. define g(n) {
  219.   return (2^n - 1);
  220. }
  221.  
  222. /* x(n) is the Optimization Routine */
  223.  
  224. define x(n) {
  225.   auto j
  226.   auto r
  227.   auto i
  228.   
  229.   if(n == 1) return (1);
  230.   j = f(1) + g(n-1);
  231.   
  232.   for(i = 2; i < n; i++) {
  233.     r = f(i) + g(n-i);
  234.     if(r < j) { j = r; d = i; }
  235.   }
  236.   return (j);
  237. }
  238.  
  239. /* main program */
  240. for(q = 4; q < w; q++) {
  241.   t = x(q-1);
  242.   m[q] = 2 * t + 1;
  243.   d[q] = d;
  244. };
  245.  
  246.  
  247. /*This for loop prints the number of discs from 1 <= n <=  w*/
  248.  
  249. for(q = 1; q < w; q++) {
  250. q;
  251. }
  252.  
  253. /*This for loop prints f(n) for 1 <= n <= w */
  254.  
  255. for(q = 1; q < w; q++) {
  256. m[q];
  257. }
  258.  
  259. /*This for loop prints i for 1 <= n <= w
  260. i represents the number of disks to be moved to tmp location using f(n)
  261. N-i-1 will be moved using g(n) */
  262.  
  263. for(q = 1; q < w; q++) {
  264. d[q];
  265. }
  266.  
  267. -- 
  268. sharma@sharma.warren.mentorg.com
  269.  
  270. There is a solution to the Tower of Hanoi problem which does not require
  271. recursion.  On odd-numbered moves, move the smallest sized disk clockwise.
  272. On even-numbered moves, make the single other move which is possible.
  273.  
  274. ==> induction/n-sphere.p <==
  275. With what odds do three random points on an n-sphere form an acute triangle?
  276.  
  277. ==> induction/n-sphere.s <==
  278. Select three points a, b, and c, randomly with respect to the surface of an
  279. n-sphere.  These three points determine a fourth, x, which is the intersection
  280. of the sphere with the axis perpendicular to the abc plane.  (Choose the pole
  281. nearest the plane.) I could have, just as easily, selected x, a distance d
  282. from x, and three points d units away from x.  The distribution of d is not
  283. uniform, but that's ok.  For every x and d, the three points abc form an acute
  284. triangle with probability p[n-1].  By induction, p[n] = 1/4.
  285.  
  286. ==> induction/paradox.p <==
  287. Is there a non-trivial property that holds for the first 10,000 positive
  288. integers, then fails?
  289.  
  290. ==> induction/paradox.s <==
  291. Consider the sequences defined by:
  292. s(1) = a; s(2) = b; s(n) = least integer such that s(n)/s(n-1) > s(n-1)/s(n-2).
  293. In other words, s(n) = 1+floor(s(n-1)^2/s(n-2)) for n >= 3.  These
  294. sequences are similar in some ways to the classically-studied Pisot
  295. sequences.  For example, if a = 1, b = 2, then we get the odd-indexed
  296. Fibonacci numbers.
  297.  
  298. D. Boyd of UBC, an expert in Pisot sequences, pointed out the following.
  299. If we let a = 8, b = 55 in the definition above, then the resulting
  300. sequence s(n) appears to satisfy the following linear recurrence
  301. of order 4:
  302.  
  303.     s(n) = 6s(n-1) + 7s(n-2) - 5s(n-3) - 6s(n-4)
  304.  
  305. Indeed, it does satisfy this linear recurrence for the
  306. first 11,056 terms.  However, it fails at the 11,057th term!
  307. And s(11057) is a 9270 digit number.
  308. (The reason for this coincidence depends on a remarkable fact
  309. about the absolute values of the roots of the polynomial
  310. x^4 - 6x^3 - 7x^2 + 5x + 6.)
  311.  
  312. ==> induction/party.p <==
  313. You're at a party.  Any two (different) people at the party have exactly one
  314. friend in common (the friend is also at the party).  Prove that there is at
  315. least one person at the party who is a friend of everyone else.  Assume that
  316. the friendship relation is symmetric and not reflexive.
  317.  
  318. ==> induction/party.s <==
  319. Here is an easy solution by induction. Let P be the set of people in the
  320. party, and n the size of P. If n=2 or 3, the result is trivial. Suppose now
  321. that n>3 and that the result is true for n-1.
  322.  
  323. For any two distinct x,y in P, write x & y to mean that `x is a friend of y',
  324. and x ~& y to mean that `x is not a friend of y'.
  325.  
  326. Take q in P. The hypothesis on the relation & is still satisfied on P-{q}; by
  327. induction, the result is thus true for P-{q}, and there is some p in P-{q}
  328. such that p & x for any x in P-{p,q}. We have two cases:
  329.  
  330. a) p & q. Then the result holds for P with p.
  331.  
  332. b) p ~& q. By hypothesis, there is a unique r in P-{p,q} such that p & r & q.
  333. For any x in P-{p,q}, if x & q, then p & x & q, and so x=r. Thus r is the
  334. unique friend of q. Now for any s in P-{q,r} there exists some x such that s &
  335. x & q, and so x=r. This means that r & s for any s in P-{q,r}, and as r & q,
  336. the results holds in P with r.
  337.  
  338. The problem can also be solved by applying the spectral theory of graphs
  339. (see for instance Bollobas' excellent book, _Extremal Graph Theory_).
  340.  
  341. The problem's condition is vacuous if there is only N=1 person at the "party", 
  342. impossible if N=2 (If you aren't your own friend, nor I mine, somebody *else*
  343. must be our mutual friend), and trivial if N=3 (everybody must be everyone
  344. else's friend).  Henceforth assume N>3.
  345.  
  346. Let A,B be two friends, and C their mutual friend.  Let a be the number
  347. of A's friends other than B and C, and likewise b,c.  Each of A's friends
  348. is also friendly with exactly one other of A's friends, and with none of
  349. B and C's other friends (if A1,B1 are friends of A,B resp. and of each other
  350. then A1 and B have more than one mutual friend); likewise for B and C.
  351. Let M=N-(a+b+c+3) be the number of people not friendly with any of A,B,C.
  352. Each of them is friendly with exactly one of A's and one of B's friends;
  353. and each pair of a friend of A and a friend of B must have exactly
  354. one of them as a mutual friend.  Thus M=ab; likewise M=ab=ac=bc. Thus
  355. either M and two of a,b,c vanish, or a=b=c=k (say), M=k^2, and N=k^3+3k+3.
  356. In the first case, say b=c=0; necessarily a is even, and A is a friend of
  357. everybody else at the party, each of whom is friendly with exactly one other
  358. person; clearly any such configuration (a graph of k/2+1 triangles with a
  359. common vertex) satisfies the problem's conditions).
  360.  
  361. It remains to show that the second case is impossible.  Since N=k^2+3k+3
  362. does not depend on A,B,C, neither does k, and it quickly follows that the
  363. party's friendship graph is regular with reduced matrix
  364.  
  365.          [  0   k+2   0  ]
  366.          [  1    1    k  ]
  367.          [  0    1   k+1 ]
  368.  
  369. and eigenvalues k+2 and +-sqrt(k+1) and multiplicities 1,m1,m2 for some
  370. *integers* m1 and m2 such that (m1-m2)*sqrt(k+1)=-(k+2) (because the graph's 
  371. matrix has trace zero).  Thus sqrt(k+1) divides k+2 and k+1 divides
  372.  
  373.         (k+2)^2=(k+1)(k+3)+1
  374.  
  375. which is only possible if k=0,  Q.E.D.
  376.  
  377. ==> induction/roll.p <==
  378. An ordinary die is thrown until the running total of the throws first
  379. exceeds 12.  What is the most likely final total that will be obtained?
  380.  
  381. ==> induction/roll.s <==
  382. Claim: If you throw a die until the running total exceeds n>=5, a final
  383. outcome of n+1 is more likely than any other.
  384.  
  385. Assume we throw an m for a total n+k>n+1, and assume m-k>=0.  Now, it
  386. is just as likely to throw an m as an m-k+1, which means that the sum
  387. n+1 is just as likely as any other.  Now consider the series of throws
  388. consisting of n-5 1's followed by a 6 and note that we cannot achieve
  389. more than an n+1 by changing the last die roll.  Hence, a total of n+1
  390. is more likely than any other.
  391.  
  392. ==> induction/takeover.p <==
  393. After graduating from college, you have taken an important managing position
  394. in the prestigious financial firm of "Mary and Lee".
  395. You are responsible for all the decisions concerning take-over bids.
  396. Your immediate concern is whether to take over "Financial Data".
  397. There is no doubt that you will be successful if you are the first to
  398. bid and that this will be profitable for the firm and you in the long
  399. run.  However, you know that there exist another n financial firms,
  400. similar to "Mary and Lee", that are also considering the possibility.
  401. Although you are likely to be the first one to move, you know that
  402. just after a take-over there is a lot of adjustment that needs to be
  403. done.  In fact, for a period of time following any take-over the
  404. successful firm becomes a prime candidate for a take-over which will
  405. cost the job of whoever is responsible for take-overs.  Among all
  406. financial firms it is common knowledge that the managers responsible
  407. for take-overs are rational and intelligent.  What is your best response?
  408.  
  409. ==> induction/takeover.s <==
  410. Assume the takeover is wise for n.  The takeover is then unwise for
  411. n+1, as the other companies now find themselves in the same situation
  412. as you for n.  If the decision is unwise for n, by similar reasoning
  413. it is wise to takeover FD for n+1.  Now note that for n=1 the takeover
  414. decision is clearly unwise, hence by induction you should takeover
  415. FD iff n is even.
  416.